<?php

/**
 * This is the model class for table "{{dynform}}".
 *
 * The followings are the available columns in table '{{dynform}}':
 * @property integer $dyn_id
 * @property integer $ady_id
 * @property string $df_label
 * @property integer $df_type
 * @property integer $qvf_id
 * @property integer $df_fieldoptions
 * @property string $df_xmltag
 *
 * The followings are the available model relations:
 * @property Adynform $ady
 */
class Dynform extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Dynform the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return '{{dynform}}';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('ady_id, df_type, qvf_id, df_fieldoptions', 'numerical', 'integerOnly'=>true),
			array('df_label', 'length', 'max'=>80),
			array('df_xmltag', 'length', 'max'=>60),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('dyn_id, ady_id, df_label, df_type, qvf_id, df_fieldoptions, df_xmltag', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'ady' => array(self::BELONGS_TO, 'Adynform', 'ady_id'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'dyn_id' => 'Dyn',
			'ady_id' => 'Ady',
			'df_label' => 'Df Label',
			'df_type' => 'Df Type',
			'qvf_id' => 'Qvf',
			'df_fieldoptions' => 'Df Fieldoptions',
			'df_xmltag' => 'Df Xmltag',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('dyn_id',$this->dyn_id);
		$criteria->compare('ady_id',$this->ady_id);
		$criteria->compare('df_label',$this->df_label,true);
		$criteria->compare('df_type',$this->df_type);
		$criteria->compare('qvf_id',$this->qvf_id);
		$criteria->compare('df_fieldoptions',$this->df_fieldoptions);
		$criteria->compare('df_xmltag',$this->df_xmltag,true);

		return new CActiveDataProvider(get_class($this), array(
			'criteria'=>$criteria,
		));
	}
}